
//通告列表用的生成页面的一些方法
$(function() {
	
   if(!window.ActiveXObject){
	   $("#selectPanel").css("margin-right","4px");
	   $("#selectPanel").css("margin-top","4px");
	   $("#selectPanel").css("padding-right","11px");
	   $("#deleteAll").css("width","48px");
	   $("#deleteAll").css("padding-left","0px");
    }
   BindCheckBox();
   initPage();
});
function initPage(){
	
	if(currentPage==1){
   			$("#fstPage").attr("src","img/gl/130.jpg");
   			$("#forePage").attr("src","img/gl/140.jpg");
   			$("#fstPage").css("cursor","default");
   			$("#forePage").css("cursor","default");
   		}else{
   			$("#fstPage").attr("src","img/gl/13.jpg");
   			$("#forePage").attr("src","img/gl/14.jpg");
   			$("#fstPage").css("cursor","pointer");
   			$("#forePage").css("cursor","pointer");
   		}
   		if(currentPage==pageCount){
   		  	$("#nextPage").attr("src","img/gl/150.jpg");
   			$("#nextPage").css("cursor","default");
   		}else{
   			$("#nextPage").attr("src","img/gl/15.jpg");
   			$("#nextPage").css("cursor","pointer");
   		}
}

//绑定多选框
function BindCheckBox(){
	        var $chkall = $('#checkedAll');
	        $chkall.unbind("click");
            var $chkarry = $('input[type="checkbox"]').not($('#checkedAll'));
            $chkall.click(function() {
                var b = $(this).attr('checked');
                $chkarry.each(function() { 
                	var deny = $(this).attr('disabled');
                	if(!deny){
                	 $(this).attr('checked', b); 
                	}
                });
            });
}
//跳转页面
function PageGo()
{
	 var page=$("#gopage").val();
	  var regNum =/^\d*$/;
	  if(page.length>0){
		  if(regNum.test(page)){
			  currentPage=parseInt(page)>pageCount?pageCount:parseInt(page);
			  if(currentPage>0){
				 fanye(currentPage);
			  }else{
				  alert("请输入大于零的数字！");
				  $("#gopage").attr("value","");
				  $("#gopage").focus();
			  }
		  }else{
			  alert("只能输入数字");
			  $("#gopage").attr("value","");
			  $("#gopage").focus();
			  }
		}else{
          alert("请输入您要跳转的页数");
		  $("#gopage").focus();
			}
	  regNum=null;
	  page=null;
}
//翻页
function ChangePage(cmd){
	if("fst"==cmd){
		//首页
		if(currentPage!=1){
			fanye(1);
		}
	}else if("fore"==cmd){
		//上一页
		if(currentPage!=1){
			fanye(currentPage-1);
		}
	}else if("next"==cmd){
		//下一页
		if(currentPage!=pageCount){
			fanye(currentPage+1);
		}
	}
	$('#checkedAll').attr('checked', false);
}
//跳转页面
function fanye(index){
	location.href = 'gl/khgl.do?page=khlist&pageNo='+index;
}
//删除
function Delete(pageNo,id){
	if(window.confirm("确定要删除该考核吗?")){
		location.href = 'gl/khgl.do?page=khlist&pageNo='+pageNo+'&delid='+id;
	}
}
//删除所选
function DelMore(){
	if(window.confirm("确定要删除所选考核吗?")){
	    var ids="";
	    var $chkarry = $('input[type="checkbox"]').not($('#checkedAll'));
        $chkarry.each(function() { 
        	if($(this).attr('checked')){
        		ids+=$(this).val()+",";
        	}
        });
        if(ids.length<1){
        	alert("请选择要删除的考核！");
        }else{
        	$("#delids").val(ids);
        	$("#delmore").submit();
        }
     }
}

